package com.zhisheng.day16_echarts.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/a/b")
public class AA {

    @GetMapping
    public List<Map<String, Object>> getStudentScores() {
        List<Map<String, Object>> students = new ArrayList<>();

        // 第一个学生的数据
        Map<String, Object> student1 = new HashMap<>();
        student1.put("id", 4);
        student1.put("name", "陆嘉豪");
        student1.put("averageScore", 74.2);

        List<Map<String, Object>> scores1 = new ArrayList<>();
        Map<String, Object> score1_1 = new HashMap<>();
        score1_1.put("time", "2025-03-01T15:33:11");
        score1_1.put("score", 81);
        scores1.add(score1_1);

        Map<String, Object> score1_2 = new HashMap<>();
        score1_2.put("time", "2025-03-08T16:05:07");
        score1_2.put("score", 66);
        scores1.add(score1_2);

        student1.put("scores", scores1);
        students.add(student1);

        // 第二个学生的数据
        Map<String, Object> student2 = new HashMap<>();
        student2.put("id", 5);
        student2.put("name", "王阳");
        student2.put("averageScore", 74.8);

        List<Map<String, Object>> scores2 = new ArrayList<>();
        Map<String, Object> score2_1 = new HashMap<>();
        score2_1.put("time", "2025-03-01T15:11:49");
        score2_1.put("score", 86);
        scores2.add(score2_1);

        Map<String, Object> score2_2 = new HashMap<>();
        score2_2.put("time", "2025-03-08T16:17:12");
        score2_2.put("score", 80);
        scores2.add(score2_2);

        student2.put("scores", scores2);
        students.add(student2);

        return students;
    }
}
